package com.com.effectivejava.serializability.util;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.Writer;

/**
 * Created by pankaj on 7/19/14.
 */
public class StackTrace {
    static String asString(Throwable toConvert){

        final Writer result = new StringWriter();
        final PrintWriter printWriter = new PrintWriter(result);
        toConvert.printStackTrace(printWriter);

        return result.toString();
    }
}
